package com.shms.service.impl;

import java.util.List;

import com.shms.entity.ShLogin;
import com.shms.service.ShLoginService;
import com.shms.bean.GroupOfLogin;
import com.shms.dao.ShLoginDao;

/**
 * 文件名：ShLoginServiceImpl.java
 * 编写者：杨勇
 * 创建时间：2013-3-11
 * 简要描述：
 * 
 */
public class ShLoginServiceImpl implements ShLoginService {
	private ShLoginDao shLoginDao;
	
	public List<ShLogin> queryLoginByExample(ShLogin shLogin) {
		return shLoginDao.queryLoginByExample(shLogin);
	}
	
	public GroupOfLogin queryLogin(GroupOfLogin groupOfLogin) {
		if (groupOfLogin.getType().equals("forward")) {
			int currentPage = groupOfLogin.getCurrentPage() - 2;
			groupOfLogin.setCurrentPage(currentPage);
		}
		return shLoginDao.queryLogin(groupOfLogin);
	}
	
	public boolean batchDelete(Integer[] nos){
		return this.shLoginDao.batchDelete(nos);
	}
	
	public boolean saveLogin(ShLogin shLogin) {
		boolean rtn = true;
		if (shLogin.getLid() == 0) {
			rtn = shLoginDao.saveLogin(shLogin);
		} else {
			rtn = shLoginDao.updateLogin(shLogin);
		}
		return rtn;
	}

	public ShLogin queryById(ShLogin shLogin) {
		return shLoginDao.queryById(shLogin);
	}
	
	public void setShLoginDao(ShLoginDao shLoginDao) {
		this.shLoginDao = shLoginDao;
	}
	
	public ShLoginDao getShLoginDao() {
		return shLoginDao;
	}
}
